#pragma once

#include "Algebra.hpp"
#include <vector>

using namespace std;

struct Solver
{
    static vector<double> solve(vector<vector<double>> a, vector<double> b)
    {
        int N = b.size();
        Matrix<double> A(N, N);
        Vector<double> B(N);

        for (int i = 0; i < N; i++)
        {
            for (int j = 0; j < N; j++)
            {
                A(i, j) = a[i][j];
            }
            B[i] = b[i];
        }
        Vector<double> X = MatrixSolver::solve(A, B);

        vector<double> x(N);
        for (int i = 0; i < N; i++)
        {
            x[i] = X[i];
        }
        return x;
    }

    static void vec_out(vector<double> &vec)
    {
        cout << "(";
        for (int i = 0; i < vec.size(); i++)
        {
            cout << vec[i] << ",";
        }
        cout << "\b)";
    }

    static void mat_out(vector<vector<double>> &mat)
    {
        for (int i = 0; i < mat.size(); i++)
        {
            vec_out(mat[i]);
            cout << endl;
        }
    }
};
